Flutter / UI Elements / Circular Progress Loader
Circular Loader
-
Usage
1. define obs variable
final RxBool _profileInProgress = false.obs; 2. Show circularprogressindicator
SizedBox( width: double.infinity, child: Obx(() { return _profileInProgress.value ? const Center( child: CircularProgressIndicator(), ) : ElevatedButton( onPressed: () { updateProfile(); }, child: const Text('Update'), ); }), ) Note Obx() . The obx() observe the variable _profileInProgress 3. show / hide loader
void updateProfile() async { _profileInProgress.value = true; ..... ...... _profileInProgress.value = false; }